<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <blockquote class="text-warning" style="font-size: 14px">
          <h4 class="text-info">
            魁字号品牌招商办 ：风风
          </h4>
          <h4 class="text-danger">
            微信：szzvip
          </h4>
          <p>
            <b>当前版本:</b> <span>v{{ version }}</span>
          </p>
          <!--          <p>-->
          <!--            <el-button-->
          <!--              type="primary"-->
          <!--              size="mini"-->
          <!--              icon="el-icon-cloudy"-->
          <!--              plain-->
          <!--              @click="goTarget('https://www.wancitaijigao.com')"-->
          <!--            >官方网站-->
          <!--            </el-button>-->
          <!--            <el-button-->
          <!--              type="info"-->
          <!--              size="mini"-->
          <!--              icon="el-icon-shopping-cart-2"-->
          <!--              plain-->
          <!--              @click="goTarget('http://aiyou.wancitaijigao.com/admin/index/login')"-->
          <!--            >爱有商城-->
          <!--            </el-button>-->
          <!--          </p>-->
        </blockquote>
      </el-col>
    </el-row>
    <!--    <el-row :gutter="20">-->
    <!--      <el-col :sm="24" :lg="12" style="padding-left: 20px">-->
    <!--        <h2>魁字号品牌会员系统</h2>-->
    <!--        <p>-->
    <!--          简介：暂无-->
    <!--        </p>-->
    <!--      </el-col>-->
    <!--      <el-col :sm="24" :lg="12" style="padding-left: 50px">-->
    <!--        <el-row>-->
    <!--          <el-col :span="12">-->
    <!--            <h2>主页介绍</h2>-->
    <!--          </el-col>-->
    <!--        </el-row>-->
    <!--        <el-row>-->
    <!--          <el-col :span="12">-->
    <!--            <h4>发展信息</h4>-->
    <!--            <ul>-->
    <!--              <li>1、商品信息，商品可获取金豆数量 (已经完成)</li>-->
    <!--              <li>2、比例设置：几个金豆换取一个名额，可获取几层上级(已经完成)</li>-->
    <!--              <li>3、用户</li>-->
    <!--              <li>4、部门-上下级</li>-->
    <!--              <li>5、积分记录</li>-->
    <!--              <li>6、下订单，审核订单</li>-->
    <!--              <li>7、兑换名额</li>-->
    <!--              <li>...</li>-->
    <!--            </ul>-->
    <!--          </el-col>-->
    <!--        </el-row>-->
    <!--      </el-col>-->
    <!--    </el-row>-->
    <el-row :gutter="20" v-if="showVideo">
      <video id="myVideo" :src="urlSrc" enable-danmu danmu-btn controls></video>
    </el-row>
    <el-row :gutter="20" v-if="!showVideo">
      <el-image v-for="url in imgList" :key="url" :src="url" lazy></el-image>
    </el-row>
  </div>
</template>

<script>
import {getIndexVideoUrl} from "@/api/base";

export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "1.0.0",
      urlSrc: undefined,
      showVideo: false,
      imgList: [],
    };
  },
  created() {
    this.getIndexInfo()
  },
  methods: {
    getIndexInfo() {
      getIndexVideoUrl().then(response => {
        if (response.data != undefined) {
          this.urlSrc = process.env.VUE_APP_BASE_API + response.data;
          this.showVideo = true
        } else if (response.imgList.length > 0) {
          let imgUrl = response.imgList.map((item) => item.indexImgUrl)
          for (let url in imgUrl) {
            this.imgList.push(process.env.VUE_APP_BASE_API + imgUrl[url])
          }
        }
      });
    },
    goTarget(href) {
      window.open(href, "_blank");
    },
  },
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }

  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }

  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>

